package cc.z8g.browser.core;

import androidx.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * 选择分支、常量等
 *
 * @author zhaoxuyang.net
 * @since 2024-08-02
 */
public class BrowserConst {

    // Hardcoded user agents
    public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36";
    public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; Android 10; Pixel Build/QP1A.190711.019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36";

    // URL Schemes
    public static final String HTTP = "http://";
    public static final String HTTPS = "https://";
    public static final String FILE = "file://";
    public static final String ABOUT = "about:";
    public static final String FOLDER = "folder://";

    // Custom local page schemes
    public static final String SCHEME_BOOKMARKS = ABOUT + "bookmarks";
    public static final String UTF8 = "UTF-8";

    // Default text encoding we will use
    public static final String DEFAULT_ENCODING = UTF8;
    public static final String INTENT_ORIGIN = "URL_INTENT_ORIGIN";

    // Allowable text encodings for the WebView
    public static final String[] TEXT_ENCODINGS = new String[]{"ISO-8859-1", UTF8, "GBK", "Big5", "ISO-2022-JP", "SHIFT_JS", "EUC-JP", "EUC-KR"};

    public static final int CLOSE_TAB_AFTER = 1;
    public static final int CLOSE_TAB_OTHERS = 2;
    public static final int CLOSE_TAB_ALL = 3;

    public static final int BOOKMARK_NEW_TAB = 1;
    public static final int BOOKMARK_BACKGROUND_TAB = 2;
    public static final int BOOKMARK_INCOGNITO_TAB = 3;
    public static final int BOOKMARK_SHARE = 4;
    public static final int BOOKMARK_COPY_LINK = 5;
    public static final int BOOKMARK_REMOVE = 6;
    public static final int BOOKMARK_EDIT = 7;

    public static final int HISTORY_NEW_TAB = 1;
    public static final int HISTORY_BACKGROUND_TAB = 2;
    public static final int HISTORY_INCOGNITO_TAB = 3;
    public static final int HISTORY_SHARE = 4;
    public static final int HISTORY_COPY_LINK = 5;
    public static final int HISTORY_REMOVE = 6;

    public static final int DOWNLOAD_DELETE = 1;
    public static final int DOWNLOAD_DELETE_ALL = 2;

    public static final int FOLDER_RENAME = 1;
    public static final int FOLDER_REMOVE = 2;

    public static final int LINK_LONG_PRESS_NEW_TAB = 1;
    public static final int LINK_LONG_PRESS_BACKGROUND_TAB = 2;
    public static final int LINK_LONG_PRESS_INCOGNITO_TAB = 3;
    public static final int LINK_LONG_PRESS_SHARE = 4;
    public static final int LINK_LONG_PRESS_COPY_LINK = 5;

    public static final int IMAGE_LONG_PRESS_NEW_TAB = 1;
    public static final int IMAGE_LONG_PRESS_BACKGROUND_TAB = 2;
    public static final int IMAGE_LONG_PRESS_INCOGNITO_TAB = 3;
    public static final int IMAGE_LONG_PRESS_SHARE = 4;
    public static final int IMAGE_LONG_PRESS_COPY_LINK = 5;
    public static final int IMAGE_LONG_PRESS_DOWNLOAD = 6;


    /** 关闭标签页，菜单对话框的选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({CLOSE_TAB_AFTER, CLOSE_TAB_OTHERS, CLOSE_TAB_ALL})
    @interface CloseTab {
    }

    /** 书签菜单对话框的选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({BOOKMARK_NEW_TAB, BOOKMARK_BACKGROUND_TAB, BOOKMARK_INCOGNITO_TAB, BOOKMARK_SHARE, BOOKMARK_COPY_LINK, BOOKMARK_REMOVE, BOOKMARK_EDIT})
    @interface Bookmark {
    }

    /** 历史菜单对话框的选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({HISTORY_NEW_TAB, HISTORY_BACKGROUND_TAB, HISTORY_INCOGNITO_TAB, HISTORY_SHARE, HISTORY_COPY_LINK, HISTORY_REMOVE})
    @interface History {
    }

    /** 下载菜单对话框的选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({DOWNLOAD_DELETE, DOWNLOAD_DELETE_ALL})
    @interface Download {
    }

    /** 目录操作选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({FOLDER_RENAME, FOLDER_REMOVE})
    @interface Folder {
    }

    /** 链接长按事件选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({LINK_LONG_PRESS_NEW_TAB, LINK_LONG_PRESS_BACKGROUND_TAB, LINK_LONG_PRESS_INCOGNITO_TAB, LINK_LONG_PRESS_SHARE, LINK_LONG_PRESS_COPY_LINK})
    @interface LinkLongPress {
    }

    /** 图片长按事件选项 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({IMAGE_LONG_PRESS_NEW_TAB, IMAGE_LONG_PRESS_BACKGROUND_TAB, IMAGE_LONG_PRESS_INCOGNITO_TAB, IMAGE_LONG_PRESS_SHARE, IMAGE_LONG_PRESS_COPY_LINK, IMAGE_LONG_PRESS_DOWNLOAD})
    @interface ImageLongPress {
    }

}
